package com.enation.app.javashop.api.client;

import com.enation.app.javashop.service.base.service.CaptchaManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @author fk
 * @version v2.0
 * @Description: 验证码对外服务
 * @date 2018/8/9 16:49
 * @since v7.0.0
 */
@RestController
@RequestMapping("/client/captcha")
@Validated
@ApiIgnore
public class CaptchaClientController {

    @Autowired
    private CaptchaManager captchaManager;

    @GetMapping
    public boolean valid(@RequestParam("uuid") String uuid,
                         @RequestParam("code")String code,
                         @RequestParam("scene")String scene){

        return this.captchaManager.valid(uuid, code, scene);
    }

    @GetMapping("/del")
    public void deleteCode(@RequestParam("uuid") String uuid,
                           @RequestParam("code")String code,
                           @RequestParam("scene")String scene) {
        this.captchaManager.deleteCode(uuid, code, scene);
    }

}
